Skip to content

Fix neuropixelsGLX.read and add scale/NIDQ support#95

Merged
stevevanhooser merged 3 commits intomainfrom
claude/fix-neuropixels-numchans-KYDyN
Apr 7, 2026
Merged

Fix neuropixelsGLX.read and add scale/NIDQ support#95
stevevanhooser merged 3 commits intomainfrom
claude/fix-neuropixels-numchans-KYDyN

Conversation

@stevevanhooser
Copy link
Copy Markdown
Contributor

Summary

  • Fix mustBePositive error: numChans and SR default to 0 as a sentinel for "read from .meta file", but mustBePositive rejected 0. Changed to mustBeNonnegative.
  • Add 'scale' option to read() (default: true): Converts raw int16 data to volts using samples2volts(). Pass 'scale', false for raw int16 output.
  • Extend NIDQ stream support: header() now parses niAiRangeMax/Min, niMaxInt, niMNGain, niMAGain, and per-type channel counts (MN/MA/XA/DW). samples2volts() applies correct per-channel-type gains for NIDQ streams.
  • Add channels argument to samples2volts(): Ensures correct per-channel gains when reading a subset of channels.

Test plan

  • Existing TestNeuropixelsGLX tests pass (updated to use 'scale', false where int16 is expected)
  • New testFormatReadScaled and testFormatReadScaleDefault verify scaled output matches manual samples2volts conversion
  • New TestNeuropixelsGLX_nidq test class covers NIDQ header parsing, MN/MA/mixed voltage scaling, and scaled/unscaled read

https://claude.ai/code/session_01GQqT3LvvCKZ7tm7TCphrL1

claude added 2 commits April 7, 2026 00:42
…NIDQ streams

- Add 'scale' option (default: true) to read() that converts raw int16 data
  to volts via samples2volts(). Pass 'scale', false for raw int16 output.
- Extend header() to parse NIDQ-specific fields: niAiRangeMax/Min, niMaxInt,
  niMNGain, niMAGain, and per-type channel counts (MN/MA/XA/DW).
- Extend samples2volts() with NIDQ support using per-channel-type gains
  (MN channels use niMNGain, MA channels use niMAGain, XA/DW use gain=1).
- Add optional channels argument to samples2volts() so correct per-channel
  gains are applied when reading a subset of channels.
- Update test to pass 'scale', false where raw int16 output is expected.

https://claude.ai/code/session_01GQqT3LvvCKZ7tm7TCphrL1
- Add testFormatReadScaled and testFormatReadScaleDefault to existing
  TestNeuropixelsGLX to verify scaled read returns correct double values
  and that scaling is the default behavior.
- Add new TestNeuropixelsGLX_nidq test class covering NIDQ header parsing,
  per-channel-type voltage scaling (MN/MA/mixed), and scaled/unscaled read.

https://claude.ai/code/session_01GQqT3LvvCKZ7tm7TCphrL1
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Test Results

121 tests  +13   121 ✅ +13   5s ⏱️ -1s
 14 suites + 1     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit 3027a1d. ± Comparison against base commit 24f8664.

@stevevanhooser stevevanhooser merged commit 61de157 into main Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants